//
//  XTXAccusationView.m
//  xiaotianxin
//
//  Created by XYC on 2019/6/25.
//  Copyright © 2019 XYC. All rights reserved.
//

#import "XTXAccusationView.h"

@interface XTXAccusationView()

@property (unsafe_unretained, nonatomic) IBOutlet UIButton *jbButton1;
@property (unsafe_unretained, nonatomic) IBOutlet UIButton *jbButton2;
@property (unsafe_unretained, nonatomic) IBOutlet UIButton *jbButton3;
@property (unsafe_unretained, nonatomic) IBOutlet UIButton *jbButton4;
@property (unsafe_unretained, nonatomic) IBOutlet UIButton *jbButton5;
@property (unsafe_unretained, nonatomic) IBOutlet UIButton *jbButton6;



@end

@implementation XTXAccusationView

- (IBAction)jbButtonDianjiShijian:(UIButton *)sender {
    if (sender.tag == 0) {
        if ([self.datMutDict[@"content"] length]) {
            [XTXNetworking networkingjubaodewangluoqingqiu:self.datMutDict.copy completionHandler:^(NSDictionary * _Nonnull dict) {
                dispatch_async(dispatch_get_main_queue(), ^{
                    [XTXGongView showTipMsg:dict[@"msg"]];
                    [self removeFromSuperview];
                });
            }];
        }else {
            [XTXGongView showTipMsg:@"请选择举报内容"];
            
        }
    }else {
        self.datMutDict[@"content"] = sender.titleLabel.text;
        for (int i = 1; i <= 6; i++) {
            UIButton *temButton = [self viewWithTag:i];
            temButton.backgroundColor = [UIColor whiteColor];
            temButton.titleLabel.textColor = rgbYanse1(0xb4b4b4);
            if (sender.backgroundColor == [UIColor whiteColor]) {
                sender.backgroundColor = rgbYanse1(0x1e1e1e);
                sender.titleLabel.textColor = [UIColor whiteColor];
            }
        }
    }
}

- (void)screenTouchUpInsideEventClick
{
    [self removeFromSuperview];
}
- (void)drawRect:(CGRect)rect {
    // Drawing code
    self.jbButton1.layer.borderWidth = 0.5;
    self.jbButton1.layer.borderColor = rgbYanse1(0xdcdcdc).CGColor;
    self.jbButton2.layer.borderWidth = 0.5;
    self.jbButton2.layer.borderColor = rgbYanse1(0xdcdcdc).CGColor;
    self.jbButton3.layer.borderWidth = 0.5;
    self.jbButton3.layer.borderColor = rgbYanse1(0xdcdcdc).CGColor;
    self.jbButton4.layer.borderWidth = 0.5;
    self.jbButton4.layer.borderColor = rgbYanse1(0xdcdcdc).CGColor;
    self.jbButton5.layer.borderWidth = 0.5;
    self.jbButton5.layer.borderColor = rgbYanse1(0xdcdcdc).CGColor;
    self.jbButton6.layer.borderWidth = 0.5;
    self.jbButton6.layer.borderColor = rgbYanse1(0xdcdcdc).CGColor;
    
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(screenTouchUpInsideEventClick)];
    [self addGestureRecognizer:tapGesture];
}



@end
